{% load humanize %}

<div class="col-12 table-responsive-md mt-3 p-0">
    {# 청약자 리스트 #}
    <div class="col-sm text-right mr-2 mb-2">
        <span class="text-black-50">총 청약 건수 : {{ reservation_list.count }} 건</span>
        <a href="{% url 'excel:reservations' %}?project={{ this_project.id }}" class="ml-3">
            <i class="mdi mdi-file-excel-box"></i> Excel Export
            <i class="mdi mdi-download ml-1"></i>
        </a>
    </div>
    <table id="scroll-horizontal-datatable"
           class="table table-hover table-centered table-condensed table-sm w-100 m-0 nowrap"
           style="word-break: keep-all;">
        <thead>
        <tr class="bg-nav-pills">
            <th scope="col"><input type="checkbox" disabled></th>
            <th class="text-center" scope="col">청약자</th>
            <th class="text-center" scope="col">차 수</th>
            <th class="text-center" scope="col">타 입</th>
            {% if this_project.is_unit_set %}
                <th class="text-center" scope="col">동호수</th>{% endif %}
            <th class="text-center" scope="col">청약 금액</th>
            <th class="text-center" scope="col">연락처[1]</th>
            <th class="text-center" scope="col">청약일</th>
        </tr>
        </thead>
        <tbody>
        {% for object in reservation_list %}
            <tr>
                <td scope="row"><input type="checkbox" disabled></td>
                <td class="text-center"><a
                        href="{% url 'rebs:contract:register' %}?project={{ object.project_id }}&task=1&order_group={{ object.order_group.id }}&type={{ object.contractunit.unit_type.id }}&contract_unit={{ object.contractunit.id }}&unit_number={{ object.contractunit.unitnumber.id }}&cont_id={{ object.id }}&p={{ request.GET.page }}">
                    {{ object.contractor.name }}
                </a>
                </td>
                <td class="text-center">{{ object.order_group }}</td>
                <td class="text-center"><i class="mdi mdi-square"
                       style="color: {{ object.contractunit.unit_type.color }};"></i> {{ object.contractunit.unit_type }}
                </td>
                {% if this_project.is_unit_set %}
                    <td class="text-center">{{ object.contractunit.unitnumber }}</td>{% endif %}
                <td class="text-right">{{ object.projectcashbook_set.first.income|intcomma }}</td>
                <td class="text-center">{{ object.contractor.contractorcontact.cell_phone }}</td>
                <td class="text-center">{{ object.contractor.reservation_date|date:"Y-m-d" }}</td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
</div>
